using System.Diagnostics;
using Kopernikus.Collections.Generic;
using Kopernikus.Parsing.AST;

namespace Kopernikus.Parsing.Earley
{
    public class ASTEvaluator<T> : IEarleyEvaluator<T, ASTNode> where T : IConvertToSymbol
    {
        #region IEarleyEvaluator<T,ASTNode> Members

        public Production Disambiguate(Set<Production> productions)
        {
            foreach (Production production in productions)
            {
                return production;
            }
            Debug.Assert(false);
            return null;
        }

        public ASTNode ReduceEmpty(Symbol symbol)
        {
            return null;
        }

        public ASTNode Shift(T token)
        {
            return new ASTTerminalNode(token);
        }

        public ASTNode Reduce(Production p, ASTNode[] rhs)
        {
            return new ASTProductionNode(p, rhs);
        }

        #endregion
    }
}